/**
 */
package wcomm_v1.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import wcomm_v1.InMessage;
import wcomm_v1.InPin;
import wcomm_v1.Messsage2Message;
import wcomm_v1.OutMessage;
import wcomm_v1.OutPin;
import wcomm_v1.Wcomm_v1Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Messsage2 Message</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link wcomm_v1.impl.Messsage2MessageImpl#getInMessage <em>In Message</em>}</li>
 *   <li>{@link wcomm_v1.impl.Messsage2MessageImpl#getOutMessage <em>Out Message</em>}</li>
 *   <li>{@link wcomm_v1.impl.Messsage2MessageImpl#getOutPin <em>Out Pin</em>}</li>
 *   <li>{@link wcomm_v1.impl.Messsage2MessageImpl#getInPin <em>In Pin</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class Messsage2MessageImpl extends NamedElementImpl implements Messsage2Message
{
  /**
   * The cached value of the '{@link #getInMessage() <em>In Message</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInMessage()
   * @generated
   * @ordered
   */
  protected InMessage inMessage;

  /**
   * The cached value of the '{@link #getOutMessage() <em>Out Message</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOutMessage()
   * @generated
   * @ordered
   */
  protected OutMessage outMessage;

  /**
   * The cached value of the '{@link #getOutPin() <em>Out Pin</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOutPin()
   * @generated
   * @ordered
   */
  protected OutPin outPin;

  /**
   * The cached value of the '{@link #getInPin() <em>In Pin</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInPin()
   * @generated
   * @ordered
   */
  protected InPin inPin;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected Messsage2MessageImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Wcomm_v1Package.Literals.MESSSAGE2_MESSAGE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public InMessage getInMessage()
  {
    if (inMessage != null && inMessage.eIsProxy())
    {
      InternalEObject oldInMessage = (InternalEObject)inMessage;
      inMessage = (InMessage)eResolveProxy(oldInMessage);
      if (inMessage != oldInMessage)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_MESSAGE, oldInMessage, inMessage));
      }
    }
    return inMessage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public InMessage basicGetInMessage()
  {
    return inMessage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setInMessage(InMessage newInMessage)
  {
    InMessage oldInMessage = inMessage;
    inMessage = newInMessage;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_MESSAGE, oldInMessage, inMessage));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public OutMessage getOutMessage()
  {
    if (outMessage != null && outMessage.eIsProxy())
    {
      InternalEObject oldOutMessage = (InternalEObject)outMessage;
      outMessage = (OutMessage)eResolveProxy(oldOutMessage);
      if (outMessage != oldOutMessage)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_MESSAGE, oldOutMessage, outMessage));
      }
    }
    return outMessage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public OutMessage basicGetOutMessage()
  {
    return outMessage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setOutMessage(OutMessage newOutMessage)
  {
    OutMessage oldOutMessage = outMessage;
    outMessage = newOutMessage;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_MESSAGE, oldOutMessage, outMessage));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public OutPin getOutPin()
  {
    if (outPin != null && outPin.eIsProxy())
    {
      InternalEObject oldOutPin = (InternalEObject)outPin;
      outPin = (OutPin)eResolveProxy(oldOutPin);
      if (outPin != oldOutPin)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_PIN, oldOutPin, outPin));
      }
    }
    return outPin;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public OutPin basicGetOutPin()
  {
    return outPin;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setOutPin(OutPin newOutPin)
  {
    OutPin oldOutPin = outPin;
    outPin = newOutPin;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_PIN, oldOutPin, outPin));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public InPin getInPin()
  {
    if (inPin != null && inPin.eIsProxy())
    {
      InternalEObject oldInPin = (InternalEObject)inPin;
      inPin = (InPin)eResolveProxy(oldInPin);
      if (inPin != oldInPin)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_PIN, oldInPin, inPin));
      }
    }
    return inPin;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public InPin basicGetInPin()
  {
    return inPin;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setInPin(InPin newInPin)
  {
    InPin oldInPin = inPin;
    inPin = newInPin;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_PIN, oldInPin, inPin));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_MESSAGE:
        if (resolve) return getInMessage();
        return basicGetInMessage();
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_MESSAGE:
        if (resolve) return getOutMessage();
        return basicGetOutMessage();
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_PIN:
        if (resolve) return getOutPin();
        return basicGetOutPin();
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_PIN:
        if (resolve) return getInPin();
        return basicGetInPin();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_MESSAGE:
        setInMessage((InMessage)newValue);
        return;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_MESSAGE:
        setOutMessage((OutMessage)newValue);
        return;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_PIN:
        setOutPin((OutPin)newValue);
        return;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_PIN:
        setInPin((InPin)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_MESSAGE:
        setInMessage((InMessage)null);
        return;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_MESSAGE:
        setOutMessage((OutMessage)null);
        return;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_PIN:
        setOutPin((OutPin)null);
        return;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_PIN:
        setInPin((InPin)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_MESSAGE:
        return inMessage != null;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_MESSAGE:
        return outMessage != null;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__OUT_PIN:
        return outPin != null;
      case Wcomm_v1Package.MESSSAGE2_MESSAGE__IN_PIN:
        return inPin != null;
    }
    return super.eIsSet(featureID);
  }

} //Messsage2MessageImpl
